const Controller = require('egg').Controller;
class VodController extends Controller {

  async getvodinfo(vodId) {
    const client = await this.vodClient();
    const res = await client.request('GetplayInfo', {
      Videoid: vodId,
    }, {});
    return res;
  }

  async getvideo() {
    const videoid = this.ctx.params.videoid;
    const dbback = await this.app.model.Video.findById(videoid);
    if (dbback) {
      const videoInfo = dbback._doc;
      const vodid = videoInfo.vodvideoId;
      const vodInfo = await this.getvodinfo(vodid);
      videoInfo.vod = vodInfo;
      this.ctx.body = videoInfo;
    } else {
      this.ctx.throw(404, '视频不存在');
    }
  }

  async getvod() {
    // do ...
  }
}

module.exports = VodController;
